<?php
$currency = Yii::app()->user->getState('currency');
$listDeli = DeliveryMethod::model()->findAllByAttributes(array('delivery_locale' => $currency));
if (isset($listDeli)) {
    ?>
    <fieldset id="form_delivery_method">
        <legend >Delivery Method</legend>
        <div class="form_fieldset">
            <table>
                <?php
                foreach ($listDeli as $method) {
                    $fee = (strtoupper($currency) != 'USD') ? Currency::convert('USD', $currency, $method->delivery_fee) : $method->delivery_fee;
                    ?>
                    <tr >
                        <td style="border-bottom: 1px dotted #ccc; padding: 6px 0 0 0;"><?php
                            if (intval($method->delivery_id) == 1) {
                                echo $form->radioButton($model, 'delivery_method', array('value' => $method->delivery_id, 'checked' => 'checked', 'uncheckValue' => null));
                            } else {
                                echo $form->radioButton($model, 'delivery_method', array('value' => $method->delivery_id, 'uncheckValue' => null));
                            }
                            ?>
                        </td>
                        <td style="border-bottom: 1px dotted #ccc; padding: 5px 0;"><?= $method->delivery_des ?></td>
                        <td style="border-bottom: 1px dotted #ccc; padding: 5px 0;" align="right"><b>$<?= formatprice($fee) . '</b> ' . $currency ?></td>
                    </tr>
                    <?php
                }
                ?>
            </table>
        </div>      
    </fieldset>
    <?php
}
?>